
#include "../include/searchparameter.h"
#include "include/literaturecard.h"
#include "include/fileviewer.h"
#include <QString>

/******************************************************************************/

//	получить имя параметра
//	unsigned int sp - перечисление параметров из SearchParameter
std::string getSearchParamName(unsigned int sp)
{
	std::string	strResult;
	switch(sp)
	{
	case Id:
		strResult = S_ID;
		break;
	case Title:
		strResult = S_TITLE;
		break;
	case Author:
		strResult = S_AUTHOR;
		break;
	case Word:
		strResult = S_ANNOTATION;
		break;
	case PublicDate:
		strResult = S_PUBLICDATE;
		break;
	case AddDate:
		strResult = S_ADDDATE;
		break;
	case Source:
		strResult = S_SOURCE;
		break;
	case Sphere:
		strResult = S_SPHERE;
		break;
	case Field:
		strResult = S_FIELD;
		break;
	case FileName:
		strResult = S_FILENAME;
		break;
	case FilePath:
		strResult = S_FILEPATH;
		break;
	}

	return	strResult;
}

/******************************************************************************/

//	получить значение параметра
//	unsigned int sp - перечисление параметров из SearchParameter
std::string getSearchParamValue(unsigned int sp, LiteratureCard card)
{
	std::string	strResult;
	switch(sp)
	{
	case Id:
		strResult = QString::number(card.getID()).toStdString();
		break;
	case Title:
		strResult = card.getTitle().toStdString();
		break;
	case Author:
		strResult = card.getAuthor().toStdString();
		break;
	case Word:
		strResult = card.getAnnotation().toStdString();
		break;
	case PublicDate:
		strResult = card.getPublicDate().toString().toStdString();
		break;
	case AddDate:
		strResult = card.getAddDate().toString().toStdString();
		break;
	case Source:
		strResult = card.getSource().toStdString();
		break;
	case Sphere:
		strResult = card.getSphere().toStdString();
		break;
	case Field:
		strResult = card.getField().toStdString();
		break;
	case FileName:
		strResult = card.getFileName().toStdString();
		break;
	case FilePath:
		strResult = card.getFilePath().toStdString();
		break;
	}

	return	strResult;
}

/******************************************************************************/
